package com.training2.bookstore.order.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.training2.bookstore.log.model.LogRecord;
import com.training2.bookstore.log.repo.LogRepository;
@Service
public class LogService {
	@Autowired LogRepository logRepository;
	public void logIt(HttpServletRequest req, String method, String url) {
		LogRecord r = new LogRecord();
		r.setMethod(method);
		r.setUrl(url);
		r.setInvokerIp(req.getRemoteAddr());
		
		logRepository.save(r);
	}
}
